#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
import cv2

def test1():
	#for i in range(0, 1000, 10):
		#print("i=%d"%i)
		#print("i=%d"%(i//10%4))
	y=0
	for i in range(0, 2048, 200):
		y=y+1
		#print("y=%d"%y)
		print(" i=%d"%(y%4))
		#print("i=%d"%i)
		#if(i<100):
		#	print("i=%d"%i)
		#if(100<i<1000):
		#	print("i=%d"%(i//100%4))
		#if(100<i<1000):
		#	print("i=%d"%(i//1000%4))

def pic_test4():

	img=np.ones((1280,2048,3),dtype="uint8")*255
	(X,Y)=(round(img.shape[1]/2),round(img.shape[0]/2))
	#yanse=[[255,0,0],[0,255,0],[0,0,255],[0,0,0]]
	yanse = (0, 0, 0)

	for i in range(0, 2048, 1):
	
		if(i<255):
			via = list(yanse)
			via[0] = 255-i
			via[1] = i
			via[2] = i
			yanse = tuple(via)
		elif(255<i<510):
			via[0] = i-255
			via[1] = 255-(i-255)
			via[2] = i-255
			yanse = tuple(via)
		elif(510<i<765):
			via[0] = i-510
			via[1] = i-510
			via[2] = 255-(i-510)
			yanse = tuple(via)
		elif(765<i<1020):
			via[0] = i-765
			via[1] = 255-(i-765)
			via[2] = 255-(i-765)
			yanse = tuple(via)
		elif(1020<i<1275):
			via[0] = 255-(i-1020)
			via[1] = i-1020
			via[2] = 255-(i-1020)
			yanse = tuple(via)
		elif(1275<i<1530):
			via[0] = 255-(i-1275)
			via[1] = 255-(i-1275)
			via[2] = i-1275
			yanse = tuple(via)
		elif(1530<i<1785):
			via[0] = 255-(i-1530)
			via[1] = 255-(i-1530)
			via[2] = 255-(i-1530)
			yanse = tuple(via)
		else:
			via[0] = i-510
			via[1] = i-510
			via[2] = 255-(i-510)
			yanse = tuple(via)
		cv2.line(img, (i, 0), (i, 1280), yanse, 20, 4)

	cv2.namedWindow('yanshi')
	cv2.imshow('yanshi',img)
	cv2.waitKey(0)
	cv2.destroyAllWindows()
	cv2.imwrite("tests4.jpg", img)

def pic_test5():

	img=np.ones((1280,2048,3),dtype="uint8")*255
	(X,Y)=(round(img.shape[1]/2),round(img.shape[0]/2))
	yanse=[[255,0,0],[0,255,0],[0,0,255],[0,0,0]]

	#for i in range(0, 1280, 10):
	#cv2.line(img, (10, 10), (10, 1280), yanse[1], 10, 4)  #00 05  10 15 20 25
	#cv2.line(img, (20, 10), (20, 1280), yanse[3], 10, 4)
	for i in range(0, 1280, 50):
		cv2.line(img, (0, i), (2048, i), yanse[i//10%4], 20, 4)


	cv2.namedWindow('yanshi')
	cv2.imshow('yanshi',img)
	cv2.waitKey(0)
	cv2.destroyAllWindows()
	cv2.imwrite("test5.jpg", img)


test1()
pic_test4()